<?php
	class Form_MenuItem extends Zend_Form{
		public function init(){
			$this->setMethod('post');
			
			$id = $this->createElement('hidden','id');
			
			$id->setDecorators(array('ViewHelper'));
			$this->addElement($id);
			
			$menuID = $this->createElement('hidden','menu_id');
			$menuID->setDecorators(array('ViewHelper'));
			
			$this->addElement($menuID);
			
			$label = $this->createElement('text','label');
			$label->setLabel('Label:');
			$label->setRequired(TRUE);
			$label->addFilter('StripTags');
			$label->setAttrib('size', 40);
			
			$this->addElement($label);
			
			$pageId = $this->createElement('select', 'page_id');
			
			$pageId->setLabel('select a page to link to: ');
			$pageId->setRequired(TRUE);
			
			$mdlPage = new Model_Page();
			$pages = $mdlPage->fetchAll(null,'name');
			$pageId->addMultiOption(0,'None');
			if($pages->count() > 0){
				foreach ($pages as $page){
					$pageId-addMutliOption($page->id, $page->name);
				}
			}
			
			$this->addElement($pageId);
			
			$link = $this->createElement('text', 'link');
			$link->setLabel('or specify a link:');
			$link->setRequired(false);
			$link->setAttrib('size', 50);
			$this->addElement($link);
			
			$submit = $this->addElement('submit', 'submit', array('label' => 'Submit'));
		}
	}
?>